Skip to content

Network based new account ban #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Network based new account ban #10

wants to merge 2 commits into from

Conversation

S-S-X
Copy link
Member

@S-S-X S-S-X commented Jan 12, 2022

WIP, for visibility / comments.

Relies on geoip caching layer and prejoin hooks (to operate on incoming connections before creating new player accounts).
For simplicity uses pattern matching for IP checks.

@S-S-X S-S-X mentioned this pull request Jan 12, 2022
@S-S-X S-S-X linked an issue Jan 12, 2022 that may be closed by this pull request
5 tasks
@BuckarooBanzay BuckarooBanzay added the enhancement New feature or request label Apr 25, 2022
Comment on lines 82 to 94
local function kick_and_delete_player_account(name)
minetest.kick_player(name, MSG_BLOCKED)
local auth_handler = minetest.get_auth_handler()
if auth_handler.get_auth(name) then
minetest.log("action", "[beowulf] Removing player account: "..name)
auth_handler.delete_auth(name)
-- Temporary IP ban could be added here but probably not that useful, can be used to skip temp account creation
else
-- Should not happen, barrier is most probably leaking for some reason if this ever gets logged
minetest.log("error", "[beowulf] Player account should exist but not found: "..name)
end
end
Copy link
Member Author

@S-S-X S-S-X Jul 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BuckarooBanzay / @OgelGames (or anyone else) Do you think this is safe enough or is there something that should be changed to make it better?

It is called when new accounts are blocked based on IP/ASN, this is workaround to allow enforcing new account ban with async geoip lookup.

Automated tests would be good (and I'll include some) to prevent account deletion because of some stupid mistake but besides that for actual implementation?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BuckarooBanzay / @OgelGames (or anyone else) Do you think this is safe enough or is there something that should be changed to make it better?

LGTM, the kick message should be clear enough i think 👍

Some little cleanup

Cleanup new account ban
@S-S-X
Copy link
Member Author

S-S-X commented Aug 3, 2022

Cleaned up a bit and rebased to master, still no tests however.
Probably some day in future I'll either do some manual testing or write some automated tests for this... I think most important thing is to make sure that kick_and_delete_player_account wont be accidentally triggered and that it wont remove any accounts that were created before ongoing authentication sequence.

@S-S-X
Copy link
Member Author

S-S-X commented Aug 4, 2022

Readme changes:

  • removed "State: WIP" (it is fully functional and tested mod).
  • added new configuration key (one introduced in this PR).
  • converted configuration section to table.

Copy link
Member Author

@S-S-X S-S-X left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pattern type selection and pattern matching are both broken, actually just reading code should easily make that clear as there's few very simple mistakes and also no pattern escaping making patterns way too complicated.

  • IP match patterns to allow subset of Lua patterns, maybe just [0-9] (with any range) and * as [0-9]+.
    • /block 127.1.*.* for 127.1.0.0/16.
    • /block 127.1.2.* for 127.1.2.0/24.
    • /block 127.1.2.[12][2-9]* for approx 127.1.2.128/25.
    • Could require first 16 bits to be static to not allow larger than /16 blocks per ban record? Or show warning if pattern covers over 16 bits.
  • ASN should allow more than just single digit...
  • ASN should probably check validity against root ASN chunk allocations (and either warning or error when private/test numbers given).
  • -logging does not do anything, I don't even remember anymore what I was supposed to do with it...
  • TBD: chat command name, currently /block <param>. Should that be changed to something else?

@BuckarooBanzay
Copy link
Member

TBD: chat command name, currently /block . Should that be changed to something else?

maybe prefix it like the other mods do with /beowulf_block <param> ?

@S-S-X S-S-X marked this pull request as draft August 7, 2022 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Block account creation with IP / ASN match
2 participants